#ifndef IPTWINDOW_H
#define IPTWINDOW_H

#include <QWidget>
#include "graph.h"
#include "connection.h"
#include <QSqlQuery>
#include <QSqlTableModel>
#include <QSqlError>
#include <QMessageBox>
#include <QItemSelectionModel>
class QSqlTableModel;

namespace Ui {
class iptwindow;
}

class iptwindow : public QWidget
{
    Q_OBJECT

public:

    explicit iptwindow(QWidget *parent = nullptr);
    ~iptwindow();




private slots:

    void on_currentChanged(const QModelIndex &current,const QModelIndex &previous);
    void on_currentRowChanged(const QModelIndex &current,const QModelIndex &previous);

    void on_pushButton_5_clicked();
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_15_clicked();

    void on_pushButton_16_clicked();

    void on_pushButton_17_clicked();

    void on_pushButton_11_clicked();

    void on_pushButton_13_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_12_clicked();

    void on_pushButton_14_clicked();

    void on_pushButton_18_clicked();

    void on_pushButton_19_clicked();

    void on_pushButton_20_clicked();

    void on_pushButton_21_clicked();

    void on_pushButton_22_clicked();

    void on_pushButton_23_clicked();

    void on_pushButton_25_clicked();

    void on_pushButton_24_clicked();

    void on_pushButton_26_clicked();

    void on_radioButton_clicked();

    void on_radioButton_2_clicked();

    void on_planetime_clicked();

    void on_traincost_clicked();

    void on_planecost_clicked();

    void on_traintime_clicked();

    void on_pushButton_27_clicked();

    void on_pushButton_29_clicked();

    void on_pushButton_31_clicked();

    void on_pushButton_33_clicked();

private:
    Ui::iptwindow *ui;
    QSqlDatabase DB;
    QSqlTableModel *tabmodel;
    QItemSelectionModel *theSeletion;
    Graph<QString> plane,train;
    void ButtonMutex();// 按钮互斥函数
    void openTable();// 打开数据库
    void openTablecity();// 转到city表
    void openTableplane();// 转到plane表
    void openTabletrain();// 转到train表
    void getFiledNames();// 获取字段名称
};

#endif // IPTWINDOW_H
